/**场景模块 */
module Scene {
	/**
	 * 游戏战斗与防御场景 ---刘伟
	 * */
	export class SceneFight extends egret.DisplayObjectContainer{
		public constructor() {
			super();
			this.air_fight = new Fighter.AirBattle();
			this.airUI = new Fighter.AirBattleUI();
			this.addEventListener(egret.Event.ADDED_TO_STAGE,this.addToStage,this);
			this.addEventListener(egret.Event.REMOVED_FROM_STAGE,this.removeFromStage,this);
		}

		/**空战内容 */
		private air_fight:Fighter.AirBattle;
		/**空战UI */
		private airUI:Fighter.AirBattleUI;
		/**空战结束 */
		public air_end:boolean = false;

		/**加入舞台 */
		private addToStage(evt:egret.Event)
		{
				
			this.air_end = false;
			this.addChild(this.airUI);			
			this.addChild(this.air_fight);
			this.addEventListener(egret.Event.ENTER_FRAME,this.updateGameView,this);
		}
		/**离开舞台 */
		private removeFromStage(evt:egret.Event)
		{
			this.removeEventListener(egret.Event.ENTER_FRAME,this.updateGameView,this);			
		}
		/**每帧检测 */
		private updateGameView(evt:egret.Event)
		{
			if(this.air_fight.turnOver)
			{
				this.air_fight.turnOver = false;
				this.removeChild(this.air_fight);
				this.removeChild(this.airUI);
				GameUtil.PlayerMessage.instance.isFight=false;	
				this.air_end = true;
			}
			
		}

	}
}